package com.rt.easyjava.base.modules.timerjob.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rt.easyjava.base.modules.timerjob.bean.TmptTimerLogBiz;
import com.rt.easyjava.base.modules.timerjob.dto.TmptTimerLogBizDto;
import com.rt.easyjava.base.modules.timerjob.mapper.TmptTimerLogBizMapper;
import com.rt.easyjava.base.modules.timerjob.service.impl.base.TmptTimerLogServiceImpl;
import com.rt.easyjava.common.base.Result;
import com.rt.easyjava.common.config.dozer.MyMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 *  服务实现类
 * @author wuxiaoyong
 * @since 2020-06-01
 */
@Service(value = "tmptTimerLogService")
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
public class TmptTimerLogBizServiceImpl extends TmptTimerLogServiceImpl {
    private final Logger logger = LoggerFactory.getLogger(TmptTimerLogBizServiceImpl.class);

    @Autowired
    private MyMapper mapper;
    @Resource
    private TmptTimerLogBizMapper tmptTimerLogBizMapper;

    // ==================================================================================
    // ========== 以下使用的是 Mybatis-plus 实现, 适合单表操作 ==============================
    // ==================================================================================

    /**
    * create a object
    * @param tmptTimerLogBizDto
    * @return
    */
    @Override
    public Result<TmptTimerLogBizDto> create(TmptTimerLogBizDto tmptTimerLogBizDto) {
        return super.create(tmptTimerLogBizDto);
    }

    /**
    * update a object by Id
    * @param tmptTimerLogBizDto
    * @param updateWrapper
    * @return
    */
    @Override
    public Result<TmptTimerLogBizDto> update(TmptTimerLogBizDto tmptTimerLogBizDto, UpdateWrapper updateWrapper) {
        return super.update(tmptTimerLogBizDto, updateWrapper);
    }

    /**
    * 分页 (无合计功能)
    * @param page
    * @param queryWrapper
    * @return
    */
    public Result<TmptTimerLogBizDto> page(Page<TmptTimerLogBiz> page, QueryWrapper<TmptTimerLogBiz> queryWrapper){
        return super.page(page, queryWrapper);
    }

    /**
    * select all by queryWrapper
    * @param queryWrapper
    * @return
    */
    @Override
    public Result<TmptTimerLogBizDto> selectBy(QueryWrapper<TmptTimerLogBiz> queryWrapper) {
        return super.selectBy(queryWrapper);
    }

    /**
    * select one by id
    * @param id
    * @return
    */
    @Override
    public Result<TmptTimerLogBizDto> selectById(Long id) {
        return super.selectById(id);
    }




    // ==================================================================================
    // ========== 以下使用的是自定义的 mapper.xml 实现, 适合多表查询 =========================
    // ==================================================================================

    /**
    * 分页查询：mybatis plus 自定义sql分页查询
    * 默认开启合计查询，按需注掉代码
    * @param page
    * @param queryWrapper
    * @return
    */
    @Override
    public Result<TmptTimerLogBizDto> myPage(Page<TmptTimerLogBiz> page, QueryWrapper<TmptTimerLogBiz> queryWrapper) {
        return super.myPage(page, queryWrapper);
    }

    @Override
    public Result<TmptTimerLogBizDto> mySelectBy(QueryWrapper<TmptTimerLogBiz> queryWrapper) {
        return super.mySelectBy(queryWrapper);
    }

    @Override
    public Result<TmptTimerLogBizDto> mySelectById(long id) {
        return super.mySelectById(id);
    }

}
